
<%@ include file="/common/taglibs.jsp"%>
<!--分页查询共用的页面-->
<%@ include file="/common/common.jsp"%>

<%@ page language="java" pageEncoding="UTF-8"%>

<%

request.setAttribute("cmdStr","REAL_MONITOR");

String sendTextUrl = "/sendText/view.action";
request.setAttribute("sendTextUrl",sendTextUrl);

%>
<!--添加弹层效果和layui-->

<!--气泡样式，author：shinion date：2019-3-6-->
<!-- <link rel="stylesheet" type="text/css" href="<%=ApplicationPath%>/css/newRealDataWindow.css" /> -->

<!-- <script type="text/javascript" src="<%=ApplicationPath%>/js/layer/layer.js"></script> -->

<script>
var closeTime = 3000;//图片按钮提示存在时间，单位毫秒

var formatStatusInfo = function(str){
	var temp = '' + str;
	if(temp.indexOf("未定位") >= 0){
		temp = temp.substring(0,8);
	}else{
		if(temp.indexOf("定位") >= 0){
			temp = temp.substring(0,7);
		}
	}
	return temp;
}

//格式化行驶状态数据
var runStatus = '' + '${gpsData.velocityDescr}';
//格式化终端状态数据
var statusTemp = '${gpsData.status}';
//格式化驾驶员数据
var driverNameTemp = '${gpsData.driverName}';
//格式化地址数据
var loactionTemp = '${gpsData.location}';
{
	if(runStatus.indexOf("停车") < 0){
		runStatus += '(km/h)';
	}

	statusTemp = formatStatusInfo(statusTemp);
	// console.log("sataus = " + statusTemp);
	
	
	if(driverNameTemp.length > 5){
		driverNameTemp = driverNameTemp.substring(0,5);
	}
	// if(driverNameTemp == ""){
	// 	driverNameTemp = "驾驶员";
	// }

	if(loactionTemp.length > 26){
		loactionTemp = loactionTemp.substring(0,26);
	}
}

/**
 * 设置页面中的车牌号
 */
var setPlateNoNew = function(plateNo){
	// console.log("需要设置的车牌号为：" + plateNo);
	var me = this;
	$(document).oneTime("500ms","setNewPlateNo",function(){
		var fun = window.parent.parent.setHisRoutePlateNo;
		if(fun){
			fun(plateNo);
		}
	});
}

//获取最后的驾驶员信息
var getLastInCardDriver = function(){
	// console.log("弹出气泡窗口，获取驾驶员信息。。。。。。");
	var driverNameTemp = "${gpsData.driverName}";
	if(driverNameTemp.length <= 0){
		var driverNameStr = "";
		var url = '<%=ApplicationPath%>/driverInfo/getLastInCardDriver.action';
		var param = {};
		param.vehicleId = ${ gpsData.vehicleId };
		Utility.getAjaxData(url, JSON.stringify(param), function (data) {
			//    console.log("接收到数据最后的插卡记录信息.........");
			//    console.log(data2);
			if (data.success) {
				if(data.data.length > 0){
					driverNameStr = data.data[0].driverName;
					if(driverNameStr.length > 5){
						driverNameStr = driverNameStr.substring(0,5);
					}
					$("#driverNameId").html(driverNameStr);
				}
			} else {
				driverNameStr = data.message;
			}
			// console.log("获取的数据为：" + driverNameStr);
		});
	}
	
}

$().ready(function() {
	//格式化状态数据

	getLastInCardDriver();

	$("#velocityDescrId").html(runStatus);

	$("#statusInfoTd").html(statusTemp);
	// var obj = document.getElementById("statusInfoTd");
	// if(obj){
	// 	obj.innerHTML = statusTemp;
	// }
	$("#driverNameId").html(driverNameTemp);
	$("#locationId").html(loactionTemp);

	$("#realtimeVideoDivImg").mouseenter(function(){
		layer.tips('实时视频', '#realtimeVideoDivImg', {
			tips: [3, '#0FA6D8'], //还可配置颜色
			time: closeTime,
		});
	});
	$("#monitorDivImg").mouseenter(function(){
		layer.tips('单独监控', '#monitorDivImg', {
			tips: [3, '#0FA6D8'], //还可配置颜色
			time: closeTime,
		});
	});
	$("#replayVideoDivImg").mouseenter(function(){
		layer.tips('轨迹回放', '#replayVideoDivImg', {
			tips: [3, '#0FA6D8'], //还可配置颜色
			time: closeTime,
		});
	});
	$("#sendTextDivImg").mouseenter(function(){
		layer.tips('文本下发', '#sendTextDivImg', {
			tips: [3, '#0FA6D8'], //还可配置颜色
			time: closeTime,
		});
	});

});



</script>

<style>


</style>
 <BODY>

<!--原有代码，暂不使用，注释-->
	<table class="maptable2"><tbody>
		<tr class="headTr"><td>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			[<span style="color:blue;">${gpsData.plateNo}(${gpsData.plateColor})</span>]
			&nbsp;&nbsp;
			行驶状态：<span id="velocityDescrId">${gpsData.velocityDescr}</span>
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			速度/方向：${gpsData.velocity}(km/h)/${gpsData.directionDescr}
			&nbsp;&nbsp;
			里程(km):${gpsData.mileage}
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			经纬度：${gpsData.orgLatitude} , ${gpsData.orgLongitude}
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			上报时间 ：${gpsData.sendTime}
			&nbsp;
			设备状态：<span id="statusInfoTd">${gpsData.status}</span>
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			驾驶员 ：
			<!-- <a href="javascript:window.parent.InfoWindow.viewDriverInfo(${gpsData.driverId});" id="driverNameId">${gpsData.driverName}</a> -->
			<span id="driverNameId">${gpsData.driverName}</span>
			&nbsp;
			电话 ： ${gpsData.telephone}
			&nbsp;
			部门 ：${gpsData.depName}
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			sim卡号 : ${gpsData.simNo}
			&nbsp;&nbsp;
			设备报警 : <span style="color:red;">${gpsData.alarmStateDescr}</span>
		</td></tr>
		<tr class="bodyTr"><td>
			&nbsp;
			地址 : <span id="locationId">${gpsData.location}</span>
		</td></tr>
		<tr style="height:35px;text-align:right;"><td>
				<span>
					<c:if test="${hasRealTimeVideoAuthority == true}">
						<img id="realtimeVideoDivImg" class="realtimeVideoDiv" 
								onclick="javascript:window.parent.InfoWindow.viewRealTimeVideo(${gpsData.vehicleId},'${gpsData.plateNo}','${gpsData.simNo}');"/>
					</c:if>
				</span>
				&nbsp;
				<span><img id="monitorDivImg" class="monitorDiv" 
					onclick="javascript:window.parent.InfoWindow.openCommandWindow('REAL_MONITOR','${gpsData.vehicleId}','单独监控','icon-greencar',null);"/></span>
				&nbsp;
				<span><img id="replayVideoDivImg" class="replayVideoDiv" 
					onclick="javascript:window.parent.parent.addHisrouteTab();setPlateNoNew('${gpsData.plateNo}');"/></span>
				&nbsp;
				<span><img id="sendTextDivImg" class="sendTextDiv" 
					onclick="javascript:window.parent.InfoWindow.viewSendTextWindow('${gpsData.vehicleId}','文本下发','/sendText/view.action');"/></span>
				&nbsp;
		</td></tr>
	</tbody></table>
	


	<!--原有代码，暂不使用，注释-->
	<!-- <table width=510 class=maptable>
	<tr><td width=16% class="tdheader">[车牌号码]:</td><td align=left>${gpsData.plateNo}
<c:if test="${hasRealTimeVideoAuthority == true}">
		<a style="margin-left:3px;" href="javascript:window.parent.InfoWindow.viewRealTimeVideo(${gpsData.vehicleId},'${gpsData.plateNo}','${gpsData.simNo}');" >打开视频</a>
</c:if>
	</td>
		<td class="tdheader" width=16%>[所属部门]:</td><td>${gpsData.depName}</td></tr>
	<tr><td class="tdheader">[经度纬度]:</td><td>${gpsData.orgLongitude},${gpsData.orgLatitude}</td><td class="tdheader">[速度方向]:</td><td>${gpsData.velocity}(km/h) ${gpsData.directionDescr}</td></tr>
	<tr>
		<td class="tdheader">[上报时间]:</td><td>${gpsData.sendTime}</td><td class="tdheader">[里程(km)]:</td>
		<td>${gpsData.mileage}</td>
	</tr>
	<tr>
		<td class="tdheader">[    司机]:</td><td>${gpsData.driverName}</td>
		<td class="tdheader">[  押运员]:</td><td>${gpsData.monitor}</td>
	</tr>
	<tr><td class="tdheader">[联系电话]:</td><td>${gpsData.telephone}</td><td class="tdheader">[sim卡号]:</td><td>${gpsData.simNo}</td></tr>
	<tr><td class="tdheader">[车辆状态]:</td><td colspan=3 id="statusInfoTd">${gpsData.status}</td></tr>
	 <tr><td class="tdheader">[设备报警]2:</td><td colspan=3 style="color:red;">${gpsData.alarmStateDescr}</td></tr>
	<tr><td style="border:solid #A6B3D2 !important;border-width:3px 0 0 0  !important;" id="address_{id}" colspan=4>${gpsData.location}</td></tr>
	</table> -->
 </BODY>
</HTML>
